<!-- 
@descrition: 树节点下的每一项用户 这里和树没有关系。
@auth: '' 
-->
<template>
	<view class="wc-box">
		
		<SubUserItem v-for="(item, index) in list" :key="index" :row.sync="item" :level="0">
		</SubUserItem>
		<u-empty v-if="!list.length" text="暂无数据" mode="list"></u-empty>

		<!-- <SubUserItem v-for="(subItem, subIndex) in item.underList" :key="subIndex" :row="subItem" :level="1">
		</SubUserItem> -->
	</view>
</template>

<script>
import SubUserItem from './components/SubUserItem.vue';
/**
	 * @descrition: '' 
	 * @auth: '' 
	 */
import { TREE_DATA } from './const';
import request from "@/utils/request";
export default {
		name: "TempSub",
		components: {
			SubUserItem
		},
		props: {
			level: {
				type: Number,
				default: 1
			}
			
		},
		data() {
			return {
				row1: {
					"user_id": 29853,
					"mobile": "13800138004",
					"count": 11,
					"visibleChildren": false,
				},
				list: [
					...TREE_DATA
				],
				
			}
		},
		computed: {},
		watch: {},
		created() {
			this.getJsonData()
		},
		mounted() {},
		methods: {
			
			getJsonData() {
				const vm = this
				// shopapi/user/getUnderUserlist?pid=99
				uni.showLoading({
					title: '加载中'
				});
				request.get("/user/getUnderUserlist", {
					params : {
					}
				}).then(res => {
					vm.list = res.list.map(item => {
						return {
							...item,
							children: []
						}
					})
					console.log("我国吧",res.list)
				}).finally(() => {
					uni.hideLoading();
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.wc-box {
	height: 100%;
	background: #f3f3f3;
	padding:30rpx;
}
</style>